Repository navigation
id(web): validate axum route syntax and renamed-capture conflicts in app_interface (#4795) - #4803
Conversation
…ts in app_interface (#4795) web_interface_from_app_toml now validates capture syntax (balanced braces, non-empty names, no repeated names, no legacy :/* segments, wildcard last) with RouteInvalid/SocketInvalid, and rejects structural overlaps with host capture routes (renamed captures, root catch-all) plus route/socket pattern conflicts with the existing Reserved and RouteSocketOverlap variants. Adds regression tests for the verified shapes; /arena + /ws/arena and other non-conflicting shapes still parse.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 49 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Fixes #4795.
What
web_interface_from_app_toml(pkgs/id/src/web/app_interface.rs) validated only leading slashes, exact host-reserved hits, the/api/world/*prefix, and route==socket (#4779). Invalid axum capture syntax and renamed-capture pattern overlaps still parsed Ok and panicked router construction increate_router_inner(routes.rs:322) /world_routes_at(world_ws.rs:60).Change
RouteInvalid/SocketInvalidvariants: unbalanced braces, empty/invalid capture names, repeated capture names, wildcard outside the final segment, legacy:/*-leading segments.parse_path_shape/shapes_conflict): captures at the same level under different names (e.g./edit/{*other},/hash/{other}), root catch-all/{*path}, and route-vs-socket pattern overlap now map to the existingRouteReserved/SocketReserved/RouteSocketOverlapvariants.arena,api/{name},api/{*rest},foo//bar,arena/{*rest}still parse.Verification
cargo test --lib --features web app_interface: 18 passed.cargo test --lib --features web web::: 527 passed.cargo clippy --lib --features web: clean for the touched file;rustfmtapplied.{bar,{},{*},/edit/{*other},/hash/{other},:-leading segments; confirmed no registration panic for/{*path},{bar}/{bar},/api/{*rest}— still rejected at parse time per the issue spec (root catch-all / ambiguous duplicates are never legitimate bindings). Note:/:DOES panic on this stack (axum v07-legacy guard), contrary to the issue draft's exclusion list, so it is now rejected;bar:baz-style mid-segment colons remain accepted.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.